﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Data;
using System.Collections.Generic;
using DAL;
using Model;
using Newtonsoft.Json;

namespace adminunittest
{
    [TestClass]
    public class UnitTest1
    {
        Admin_DAL admin_DAL = new Admin_DAL();
        Reader_DAL Reader_DAL = new Reader_DAL();
        Admin admin = new Admin();
        [TestMethod]
        public void TestMethod1()
        {
            DataTable a = admin_DAL.selectAdmin1("123456").Tables[0];
            string aa = JsonConvert.SerializeObject(a);
            string b = "[{\"LoginId\":\"123456\",\"LoginPwd\":\"123456\",\"LoginType\":\"普通管理员\",\"LoginRemark\":\"123456\"}]";
            Assert.AreEqual(aa, b);
        }
        [TestMethod]
        public void TestMethod2()
        {
            DataTable data = admin_DAL.selectAdmin2("普通管理员", "123456").Tables[0];
            string a = JsonConvert.SerializeObject(data);
            string b = "[{\"LoginId\":\"123456\",\"LoginPwd\":\"123456\",\"LoginType\":\"普通管理员\",\"LoginRemark\":\"123456\"}]";
            Assert.AreEqual(a, b);
        }
        [TestMethod]
        public void TestMethod3()
        {
            
            string a =JsonConvert.SerializeObject(admin_DAL.selectAdminn("123456"));
            string b = "[{\"LoginId\":\"123456\",\"LoginPwd\":\"123456\",\"LoginType\":\"普通管理员\",\"LoginRemark\":\"123456\"}]";
            Assert.AreEqual(a, b);
        }
    }
}
